//
//  AIHttpManager.h
//  MiaMind
//
//  Created by Vill on 2023/11/24.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef void (^Response)(id _Nullable result);
typedef void (^Error)(NSError *_Nullable error);

#define AIManager [AIHttpManager manager]

@interface AIHttpManager : NSObject

+ (instancetype)manager;

@property(nonatomic,strong) AFHTTPSessionManager *sessionManager;

- (void)requestMethod:(NSString *)method url:(NSString *_Nullable)url parameters:(NSDictionary *_Nullable)parameters successBlock:(Response _Nullable)successBlock failedBlock:(Error _Nullable)failedBlock showHUD:(BOOL)showHUD;

- (void)uploadImage:(UIImage *)image url:(NSString *_Nullable)url successBlock:(Response _Nullable)successBlock failedBlock:(Error _Nullable)failedBlock showHUD:(BOOL)showHUD;

/**
 取消所有请求
 */
- (void)cancelAllRequest;

@end

NS_ASSUME_NONNULL_END
